package 建造者模式;

/**
 * builder 大黄狗
 *
 * @author ithuameng
 */
public class BigYellowDogBuild {

    private Integer age;
    private String name;
    private String sex;
    private Integer height;
    private Integer weight;

    public BigYellowDogBuild(DogBuilder builder) {
        age = builder.age;
        name = builder.name;
        sex = builder.sex;
        height = builder.height;
        weight = builder.weight;
    }

    public void print() {
        System.out.println(this.age + " " + this.name + " " + this.sex + " " + this.height + " " + this.weight);
    }

    public static class DogBuilder {

        private Integer age;
        private String name;
        private String sex;
        private Integer height;
        private Integer weight;

        public DogBuilder setAge(Integer age) {
            this.age = age;
            return this;
        }
        public DogBuilder setName(String name) {
            this.name = name;
            return this;
        }
        public DogBuilder setSex(String sex) {
            this.sex = sex;
            return this;
        }
        public DogBuilder setHeight(Integer height) {
            this.height = height;
            return this;
        }
        public DogBuilder setWeight(Integer weight) {
            this.weight = weight;
            return this;
        }

        public BigYellowDogBuild bulid() {
            return new BigYellowDogBuild(this);
        }
    }
}
